#include <iostream>

using namespace std;

void insertionSort(int* num, int size)
{
	int temp = 0;
	for (int i = 1; i < size; i++)
	{
		temp = num[i];
		int j = i - 1;
		// 只要j下标的值比i下标的值大，就不断地把j下标的数往i位置挪
		while (j >= 0 && temp < num[j])
		{
			num[j + 1] = num[j];
			j--;
		}
		// 最终找到一个j下标的值不大于i下标的值时
		// 将i位置的值插入到这里
		num[j + 1] = temp;
	}
}

int main()
{
	int num[10] = { 4,85,22,90,86,80,54,3,11,18 };
	insertionSort(num, 10);
	for (int i = 0; i < 10; i++)
	{
		if (i == 0)
		{
			cout << num[i];
		}
		else
		{
			cout << "," << num[i];
		}
	}
	cout << endl;
}